﻿using EnvDTE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace MysoftVSPlugin
{
    /// <summary>
    /// Window1.xaml 的交互逻辑
    /// </summary>
    public partial class CodeMainWindow : System.Windows.Window
    {
        private DTE dte = null;
        public CodeMainWindow(ref DTE dte)
        {
            this.dte = dte;
            InitializeComponent();
        }

        private void Ok_Click(object sender, RoutedEventArgs e)
        {
            EnvDTE.TextSelection ts = dte.ActiveDocument.Selection as EnvDTE.TextSelection;

            //移动光标到第一行第一列
            ts.MoveToLineAndOffset(1, 1);

            ts.NewLine();

            ts.Insert("using System.Text;");

            ts.NewLine();
        }
    }
}
